#include <iostream>
#include <fstream>
#include <cassert>
#include "sqlist.h"

using namespace std;

typedef int elemtype;
typedef sqlisttpl<elemtype> sqlist;

int compare( sqlist &, sqlist & );

int main()
{
    ifstream in( "in02.txt" );
    int i, n;

    in >> n;
    sqlist sa(n);
    for ( i = 0; i < n; i++ )
	in >> sa[i];

    in >> n;
    sqlist sb(n);
    for ( i = 0; i < n; i++ )
	in >> sb[i];

    sa.sq_print(); cout << endl;
    sb.sq_print(); cout << endl;

    int r = compare( sa, sb );
    if( r == -1 ) cout << "Less!" << endl;
    else if( r == 0 ) cout << "Equal!" << endl;
    else cout << "Greater!" << endl;
	
    return 0;
}

/* ******************************************************
 *             Answer to this question.
 * ******************************************************/
int compare( sqlist &a, sqlist &b )
{
    int i, j;
    int al, bl;
	
    al = a.sq_len();
    bl = b.sq_len();
    for( i = j = 0; i < al && j < bl && a[i] == b[j]; i++, j++ )
	;
    if( i >= al && j >= bl ) return 0;
    if( i >= al ) return -1;
    else if ( j >= bl ) return 1;
    else return a[i] < b[j] ? -1 : 1;
}

